<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Machinamentum: Riferimenti per il file accesso_dati.cc</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Machinamentum
   </div>
   <div id="projectbrief">Semplice gioco per progetto d&#39;esame</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generato da Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Cerca');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Pagina&#160;Principale</span></a></li>
      <li><a href="annotated.html"><span>Classi</span></a></li>
      <li class="current"><a href="files.html"><span>File</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Cerca" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Elenco&#160;dei&#160;file</span></a></li>
      <li><a href="globals.html"><span>Elementi&#160;dei&#160;file</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tutto</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classi</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>File</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funzioni</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variabili</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Pagine</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Composti</a> &#124;
<a href="#func-members">Funzioni</a> &#124;
<a href="#var-members">Variabili</a>  </div>
  <div class="headertitle">
<div class="title">Riferimenti per il file accesso_dati.cc</div>  </div>
</div><!--header-->
<div class="contents">

<p>Modulo per l'accesso e il salvataggio dei dati durante l'esecuzione del programma.  
<a href="#details">Continua...</a></p>
<div class="textblock"><code>#include &lt;allegro5/allegro&gt;</code><br/>
<code>#include &quot;<a class="el" href="struttura__dati_8h_source.html">struttura_dati.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="file__IO_8h_source.html">file_IO.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="accesso__dati_8h_source.html">accesso_dati.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="nested-classes"></a>
Composti</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfotogramma.html">fotogramma</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Struttura alla base della lista del replay.  <a href="structfotogramma.html#details">Continua...</a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Funzioni</h2></td></tr>
<tr class="memitem:adc81cd7184c8d721239ad52ea74904bc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="accesso__dati_8cc.html#adc81cd7184c8d721239ad52ea74904bc">buffer_replay</a> (ALLEGRO_BITMAP *bitmap)</td></tr>
<tr class="memitem:abc3856c9e261500a3f021cb9aab510d4"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="accesso__dati_8cc.html#abc3856c9e261500a3f021cb9aab510d4">salva_replay</a> ()</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="var-members"></a>
Variabili</h2></td></tr>
<tr class="memitem:ad34412c1187b0db58a583bd83f495c92"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structfotogramma.html">fotogramma</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92">replay</a></td></tr>
<tr class="memdesc:ad34412c1187b0db58a583bd83f495c92"><td class="mdescLeft">&#160;</td><td class="mdescRight">Puntatore alla testa della lista dei fotogrammi.  <a href="#ad34412c1187b0db58a583bd83f495c92"></a><br/></td></tr>
</table>
<a name="details" id="details"></a><h2>Descrizione dettagliata</h2>
<div class="textblock"><p>Modulo per l'accesso e il salvataggio dei dati durante l'esecuzione del programma. </p>
</div><h2>Documentazione delle funzioni</h2>
<a class="anchor" id="adc81cd7184c8d721239ad52ea74904bc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void buffer_replay </td>
          <td>(</td>
          <td class="paramtype">ALLEGRO_BITMAP *&#160;</td>
          <td class="paramname"><em>bitmap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="fragment"><div class="line">                                          {</div>
<div class="line">        <span class="comment">//creo il nuovo fotogramma</span></div>
<div class="line">        <a class="code" href="structfotogramma.html" title="Struttura alla base della lista del replay.">fotogramma</a>* f = <span class="keyword">new</span> <a class="code" href="structfotogramma.html" title="Struttura alla base della lista del replay.">fotogramma</a>;</div>
<div class="line">        f-&gt;<a class="code" href="structfotogramma.html#a220274499600dc0c23990bd057ba193b">bitmap</a> = al_clone_bitmap(bitmap);</div>
<div class="line">        f-&gt;<a class="code" href="structfotogramma.html#a795548186233adf265ac364253495a33">prossimo</a> = NULL;</div>
<div class="line"></div>
<div class="line">        numero_fotogrammi++;</div>
<div class="line">        </div>
<div class="line">        <span class="comment">//Se non ci sono ancora fotogrammi lo inserisco come primo      </span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a> == NULL){</div>
<div class="line">                <a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a> = f;</div>
<div class="line">                ultimo = f;</div>
<div class="line">                <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line">        </div>
<div class="line">        <span class="comment">//Aggancio il fotogramma all&#39;ultimo esistente e faccio puntare ultimo al fotogramma appena inserito</span></div>
<div class="line">        ultimo-&gt;<a class="code" href="structfotogramma.html#a795548186233adf265ac364253495a33">prossimo</a> = f;</div>
<div class="line">        ultimo = f;</div>
<div class="line"></div>
<div class="line">        <span class="comment">//Se ho raggiunto il massimo di fotogrammi elimino il più vecchio (quello in testa)</span></div>
<div class="line">        <span class="keywordflow">if</span> (numero_fotogrammi &gt; max_fotogrammi){</div>
<div class="line">                <a class="code" href="structfotogramma.html" title="Struttura alla base della lista del replay.">fotogramma</a>* da_eliminare = <a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a>;</div>
<div class="line">                <a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a> = <a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a>-&gt;<a class="code" href="structfotogramma.html#a795548186233adf265ac364253495a33">prossimo</a>;</div>
<div class="line">                al_destroy_bitmap(da_eliminare-&gt;<a class="code" href="structfotogramma.html#a220274499600dc0c23990bd057ba193b">bitmap</a>);        <span class="comment">//Bisogna eliminare anche il bitmap puntato dal fotogramma!</span></div>
<div class="line">                <span class="keyword">delete</span> da_eliminare;</div>
<div class="line">                </div>
<div class="line">        }</div>
<div class="line">                </div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="abc3856c9e261500a3f021cb9aab510d4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool salva_replay </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="fragment"><div class="line">                   {</div>
<div class="line">        <span class="comment">//creo array di bitmap</span></div>
<div class="line">        ALLEGRO_BITMAP array_replay = <span class="keyword">new</span> ALLEGRO_BITMAP[numero_fotogrammi];</div>
<div class="line">        </div>
<div class="line">        <span class="comment">//Salvo nell&#39;array i bitmap dei fotogrammi</span></div>
<div class="line">        <a class="code" href="structfotogramma.html" title="Struttura alla base della lista del replay.">fotogramma</a>* p = <a class="code" href="accesso__dati_8cc.html#ad34412c1187b0db58a583bd83f495c92" title="Puntatore alla testa della lista dei fotogrammi.">replay</a>;</div>
<div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; numero_fotogrammi; i++){</div>
<div class="line">                array_replay[i] = (<a class="code" href="structfotogramma.html" title="Struttura alla base della lista del replay.">fotogramma</a>-&gt;<a class="code" href="structfotogramma.html#a220274499600dc0c23990bd057ba193b">bitmap</a>)*;</div>
<div class="line">                p = p-&gt;<a class="code" href="structfotogramma.html#a795548186233adf265ac364253495a33">prossimo</a>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">//Salvo array su file</span></div>
<div class="line">        <span class="keywordtype">bool</span> successo = <a class="code" href="file__IO_8cc.html#a325929b97466a045f0aa6926804b48a5">replay_to_file</a>(array_replay, numero_fotogrammi);</div>
<div class="line">        <span class="keywordflow">if</span> (!successo) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">//Dealloco array</span></div>
<div class="line">        <span class="keyword">delete</span>[] array_replay;</div>
<div class="line">        </div>
<div class="line">        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<h2>Documentazione delle variabili</h2>
<a class="anchor" id="ad34412c1187b0db58a583bd83f495c92"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structfotogramma.html">fotogramma</a>*  replay</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Puntatore alla testa della lista dei fotogrammi. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generato Gio 3 Lug 2014 17:12:28 per Machinamentum da &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>
